<template>
  <div class="rong">
    <div class="gun"></div>
    <!-- 头部 -->
    <div class="top">
      <h1>全部板块</h1>
      
    <i @click="chang(3)" class="el-icon-error"></i>
    </div>
    <!-- 内容 -->
    <div class="booy">
      <div class="top1">
        <div class="left">
          <p class="p1">我的板块</p>
          <p class="p2">点击进入板块</p>
        </div>
        <!-- <div class="p3" @click="flag=!flag">{{flag?'完成':'编辑'}}</div>
         -->
         <p class="p3">编辑</p>
      </div>
      <!-- 板块内容 -->
      <div class="rongq">
        <div class="button">
          <p @click="chang(1)">关注</p>
        </div>
        <div class="button">
          <p >推荐</p>
        </div>
        <div class="button">
          <p @click="chang(2)">热榜</p>
        </div>
        <div v-for="(p,index) in mylist" :key="index" @click="delMyBlock(index)" class="button">
          <p>{{p}}</p>
        </div>
      </div>
      <!-- 猜你喜欢 -->
      <div class="top2">
          <p class="p1">猜你喜欢</p>
          <p class="p2">点击添加板块</p>
      </div>
      <!-- 点赞内容 -->
      <div class="dak">
       <img src="./image/01.png">
       <img src="./image/02.png">
       <img src="./image/03.png">
       <img src="./image/04.png">
        </div>
        <!-- 更多内容 -->
      <div class="top2">
          <p class="p1">更多板块</p>
          <p class="p2">点击添加板块</p>
      </div>
      <div class="inpu">
         <div class="button" v-for="(p,index) in morelist" :key="index" @click="addToMyBlock(index)">
          <p>{{p}}</p>
         <i class="el-icon-circle-plus"></i>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Moban',
  data(){
      return{
        //状态0,不允许编辑我的模块
        flag:false,
        mylist:[],
        morelist:['职场','法律','动漫','游戏','音乐','数码','亲子','汽车','家居','故事','知识','圈子','校园','饭圈','二次元','影视','北京','美食']
      }
    },
  methods:{ 
    chang(type){
      if(type===3){ 
        this.$router.push('/home/chart') 
      }else if(type===1){ 
        this.$router.push('/home/follow')
      }else if(type===2){ 
        this.$router.push('/home/chart')
      }
       
    },
     addToMyBlock(index){
        let a = this.morelist.splice(index,1)
        this.mylist.push(a[0])
      },
      delMyBlock(index){
        // if(this.flag){
          let a = this.mylist.splice(index,1)
          this.morelist.push(a[0])
        // }
      }
  }
}
</script>

<style lang='less' scoped>
  .rong{
    position: fixed;
    top: 2px;
    width: 375px;
    border-top: rgb(87, 85, 85) solid 1px;
    border-radius: 30px 30px 0 0;
    height: 100%;
    .gun{
      width: 60px;
      height: 5px;
      background-color: rgb(88, 88, 88);
      margin-left: 150px;
      margin-top: 10px;
      border-radius: 50px;
    }
    .top{
      margin: 20px;
      display: flex;
      justify-content: space-between;
      h1{
        margin-top: 5px;
        font-size: 22px;
        font-weight: bold;
      }
      i{
        font-size: 30px;
        color: rgb(121, 120, 120);
      }
    }
    .booy{
      .top1{
         margin: 20px;
         margin-top: 50px;
        display: flex;
        justify-content: space-between;
        .left{
          display: flex;
          .p1{
            font-size: 18px;
            color: rgb(5, 5, 5);
            padding-right: 20px;
            margin-top: -3px;
          }
          .p2{
            font-size: 15px;
            color: rgb(134, 134, 134);
          }
        } 
        .p3{
            color: rgb(38, 17, 231);
          }
      }
      .rongq{
        width: 375px;
        height: 100%;
        margin-bottom: 20px;
        overflow: hidden;
        .button{
          width: 70px;
          height: 40px;
          background-color: rgb(233, 229, 229);
          border-radius: 20px;
          margin: 10px 5px 0 15px;
          float: left;
          p{
            line-height: 40px;
           text-align: center;
          }
        }
      }
      .top2{
        margin-left: 22px;
        display: flex;
        width: 375px;
        height: 100%;
            .p1{
            font-size: 18px;
            color: rgb(5, 5, 5);
            padding-right: 20px;
          }
          .p2{
            font-size: 15px;
            color: rgb(134, 134, 134);
          }
         
      }
      .dak{
            width: 350px;
            margin: 20px;
            img{
              width: 75px;
              height: 75px;
              margin-right: 12px;
            }
    }
    .inpu{
      margin-top: 10px;
      .button{
          width: 70px;
          height: 40px;
          border: rgb(180, 176, 176) dashed 1px;
          border-radius: 20px;
          margin: 10px 5px 0 15px;
          float: left;
           p{
            line-height: 40px;
           text-align: center;
           font-size: 14px;
          }
          i{
           color: rgb(180, 176, 176);
           position: relative;
           bottom: 45px;
            left: 58px;
          }
      }
    }
  }
  }
</style>
